/*
 * Worker.h
 *
 *  Created on: 31-07-2011
 *      Author: cristian
 */

#ifndef WORKER_H_
#define WORKER_H_

#include <string>
#include <list>
#include "AmbienteAbstract.h"

#include "Logger.h"
#include "Nodo.h"
#include "Data.h"
#include <pthread.h>


class Worker: Nodo {

private:

	unsigned int id;
	std::string nombre;
	std::string descripcion;
	pthread_t* thread;
	pthread_attr_t* attr;
	int run;
	AmbienteAbstract* ambiente;
	list<Data*> datos;

public:

	Logger* logger;
    list<Data*> getDatos() const;
    void setDatos(list<Data*> datos);
    unsigned int getId() const;
    void setId(unsigned int id);
    AmbienteAbstract *getAmbiente() const;
    void setAmbiente(void* ambiente);

    int getRun() const;
    void setRun(int run);
    pthread_attr_t *getAttr() const;
    pthread_t *getThread() const;
    void setAttr(pthread_attr_t *attr);
    void setThread(pthread_t *thread);

	Worker(unsigned int id, std::string nombre, std::string descripcion);
	virtual ~Worker();
	std::string getDescripcion() const;
	std::string getNombre() const;
	void setDescripcion(std::string descripcion);
	void setNombre(std::string nombre);
	void trace();
	Worker* clone();
	void newPos(unsigned int x, unsigned int y);
	void* work(void* arg);
	static void* start(void* arg);

};

#endif /* WORKER_H_ */
